cmake_minimum_required(VERSION 3.5)

project(LaunchProgress LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories("D:\\SDK\\vc141\\Inc\\SQLite")

find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif()


include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories(${OPENMP_INCLUDE_DIRS})


if(ANDROID)
  add_library(LaunchProgress SHARED
    main.cpp
    mainwindow.cpp
    mainwindow.h

    progressform.h
    progressform.cpp
    progressform.ui
    mainwindow.ui

    ThreadRunner.cpp
    ThreadRunner.h
  )
else()
  add_executable(LaunchProgress
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    progressform.h
    progressform.cpp
    progressform.ui
    ThreadRunner.cpp
    ThreadRunner.h
    io/PartURDF.h io/PartURDF.cpp
    io/FileOp.h

  )

add_executable(mvDirAndCreateMap
  mvDirAndCreateMap.h mvDirAndCreateMap.cpp
  runMap.cpp
)

add_executable(cxdd
    cxdd.cpp
    io/WrlInfo.h
    io/SerializeBasic.h
    io/JointData.h
    io/SerializeBasic.cpp
    io/StartProcess.h
    io/StartProcess.cpp
    dd/CombineJoint.cpp
    dd/CombineJoint.h
    CXScheduler.h
    CXScheduler.cpp
)
endif()

target_link_libraries(LaunchProgress PRIVATE Qt5::Widgets)

target_link_libraries(mvDirAndCreateMap PRIVATE ${SQLite3_LIBRARIES})
target_link_libraries(cxdd PRIVATE ${SQLite3_LIBRARIES}  OpenMP::OpenMP_CXX)


#DEFINITIONS(RUN_APP)
target_compile_definitions(cxdd PRIVATE RUN_APP=1)
